package com.ifonly.activerecord.helpers;

import java.util.HashMap;
import java.util.Map;

/**
 * @author <a href="mailto:ifonlymaster@163.com">ifonly</a>
 * @version 1.0 2015-12-22 13:52
 * @since JDK 1.6
 */
public class TypeDefaultHelper {

    private static Map<Class<?>, Object> typeDefaultMapping = new HashMap<Class<?>, Object>() {
        {
            put(boolean.class,          false);
            put(int.class,              0);
            put(long.class,             0L);
            put(float.class,            0.0F);
            put(double.class,           0.0);
            put(short.class,            0);
            put(char.class,             "");
            put(byte.class,             0);
        }
    };

    public static Object typeDefault(Class<?> type) {
        return typeDefaultMapping.get(type);
    }

}
